import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    routes: [],
    sessions: {},
    hrs: [],
    currentSession: null,
    currentHr: JSON.parse(window.sessionStorage.getItem("user")),
    filterKey: '',
    stomp: null,
    isDot: {}
  },
  mutations: {
    INIT_CURRENTHR(state, hr) {
      state.currentHr = hr;
    },
    initRoutes(state, data) {
      this.state.routes = data;
    },
    changeCurrentSession(state, currentSession) {
      Vue.set(state.isDot, state.currentHr.username + '#' + currentSession.username, false);
      state.currentSession = currentSession;
    },
    INIT_HR(state, data) {
      state.hrs = data;
    }
  },
  actions: {
  }
})

export default store;
